package application;

import java.util.ArrayList;
import java.util.List;

public class Bank {
	private List<Account> accounts;
	public Account validate(String cardId, String passwd){
		accounts =new ArrayList<>();
		Account account = new Account();
		account.setCardId("1");
		account.setPasswd("1");
		account.setBalance(1000);
		accounts.add(account);
		System.out.println("sywysghwgw");
		for(int i = 0; i< accounts.size(); i++){
			if(accounts.get(i).getCardId().equals(cardId)&& accounts.get(i).getPasswd().equals(passwd)){
				return accounts.get(i);
			}
		}
		return null;
	}
	public static boolean updateBalance(Account account,int amount) {
		if(account.getBalance()>=amount) {
			account.setBalance(account.getBalance()-amount);
			return true;
		}
		return false;
	}

}
